* This do-file reproduces the estimates reported in Online Appendix B
cd "/Users/madselkjaer/Dropbox/PhD project/Lit review/Quant review/PoP_submission/replication material/"
use "coef_wide.dta", clear

************************************************************************
* HL_7_alt1: equal representation cat broader .75-1.25
* HL_7_alt2: factor=3; note this is only a relevant alternative coding for the 7 cat variable
* HL_7_alt3: equal representation cat broader .75-1.25 and factor=3; note this is only a relevant alternative coding for the 7 cat variable
************************************************************************

* Tables B2-B4
foreach n of numlist 1/3 {
* HL
meologit HL_7_alt`n' global i.issue influence  us distance_HL ln_n pre_diff_HL if p_HL_10==1 || study:
outreg2 using reg_table_alt`n', tex  dec(2) alpha(0.05) symbol(*) addstat(Log Likelihood, `e(ll)') sortvar(us influence  party global issue distance_HL distance_HM ln_n) lab replace
*US
meologit HL_7_alt`n' global i.issue i.party influence  distance_HL ln_n pre_diff_HL if us==1 & p_HL_10==1 || study:
outreg2 using reg_table_alt`n', tex  dec(2) alpha(0.05) symbol(*) addstat(Log Likelihood, `e(ll)') sortvar(us influence  party global issue distance_HL distance_HM ln_n) lab append
* HM
meologit HM_7_alt`n' global i.issue influence  us distance_HM ln_n pre_diff_HM if p_HM_10==1 || study:
outreg2 using reg_table_alt`n', tex  dec(2) alpha(0.05) symbol(*) addstat(Log Likelihood, `e(ll)') sortvar(us influence  party global issue distance_HL distance_HM ln_n) lab append
*US
meologit HM_7_alt`n' global i.issue i.party influence  distance_HM ln_n pre_diff_HM if us==1 & p_HM_10==1 || study:
outreg2 using reg_table_alt`n', tex  dec(2) alpha(0.05) symbol(*) addstat(Log Likelihood, `e(ll)') sortvar(us influence  party global issue distance_HL distance_HM ln_n) lab append
}


* Figures B4-B5, B7-B8, and B10-B11. 
**** calculated predicted probabilities to graph - this code is for the high vs low comparison
foreach n of numlist 1/3 {
use "coef_wide.dta", clear

local X = "alt"

meologit HL_7_`X'`n' global i.issue influence  us distance_HL ln_n pre_diff_HL if p_HL_10==1 || study:
predict pr* if e(sample)
keep if e(sample)


* Global
preserve
keep pr1-pr7 global
foreach v of varlist pr1-pr7 {
bysort global: egen re_`v'=mean(`v')
}

label define yesno_gl  0 "No" 1 "Yes"
label values global yesno_gl


keep global re_*
duplicates drop re_pr1, force
reshape long re_pr, i(global) j(HL_7)

ren global lab
decode lab, g(re_lab)
g byvar="General political ideology"


save "prpHL_global_`X'`n'.dta", replace
restore

* issue
preserve
keep pr1-pr7 issue
foreach v of varlist pr1-pr7 {
bysort issue: egen re_`v'=mean(`v')
}

keep issue re_*
duplicates drop re_pr1, force
reshape long re_pr, i(issue) j(HL_7)

ren issue lab
decode lab, g(re_lab)
g byvar="Issue"

save "prpHL_issue_`X'`n'.dta", replace
restore


* Influence
preserve
keep pr1-pr7 influence
foreach v of varlist pr1-pr7 {
bysort influence: egen re_`v'=mean(`v')
}

keep influence re_*
duplicates drop re_pr1, force
reshape long re_pr, i(influence) j(HL_7)

ren influence lab
decode lab, g(re_lab)
g byvar="N of groups included in a model"

save "prpHL_influence_`X'`n'.dta", replace
restore

* Region
preserve
g byte temp =us
drop us
ren temp us
label define lb_us  0 "Not U.S." 1 "U.S."
label values us lb_us

keep pr1-pr7 us
foreach v of varlist pr1-pr7 {
bysort us: egen re_`v'=mean(`v')
}

keep us re_*
duplicates drop re_pr1, force
reshape long re_pr, i(us) j(HL_7)

ren us lab
decode lab, g(re_lab)
g byvar="Region"

save "prpHL_region_`X'`n'.dta", replace
restore

* Partisanship
use "coef_wide.dta", clear
meologit HL_7_`X'`n' global i.issue i.party influence distance_HL ln_n pre_diff_HL if us==1 & p_HL_10==1 || study:
predict pr* if e(sample)
keep if e(sample)

keep pr1-pr7 party
foreach v of varlist pr1-pr7 {
bysort party: egen re_`v'=mean(`v')
}

keep party re_*
duplicates drop re_pr1, force
reshape long re_pr, i(party) j(HL_7)

ren party lab
decode lab, g(re_lab)
g byvar="Partisanship"

save "prpHL_party_`X'`n'.dta", replace

use "prpHL_global_`X'`n'.dta", clear
append using "prpHL_issue_`X'`n'.dta"
append using "prpHL_influence_`X'`n'.dta"
*append using "prpHL_pre_diff_`X'`n'.dta"
append using "prpHL_region_`X'`n'.dta"
append using "prpHL_party_`X'`n'.dta"

g id=1 if byvar=="Region"
replace id=2 if byvar=="N of groups included in a model"
*replace id=3 if byvar=="Preference divergence"
replace id=3 if byvar=="Partisanship"
replace id=4 if byvar=="General political ideology"
replace id=5 if byvar=="Issue"

label values lab .

save "prpHL_all_`X'`n'.dta", replace


**** calculated predicted probabilities to graph - this code is for the high vs middle comparison
use "coef_wide.dta", clear
label define lb_us  0 "Not U.S." 1 "U.S."
label values us lb_us

meologit HM_7_`X'`n' global i.issue influence us distance_HM ln_n pre_diff_HM if p_HM_10==1 || study:
predict HMpr* if e(sample)
keep if e(sample)


* global
preserve
keep HMpr1-HMpr7 global
foreach v of varlist HMpr1-HMpr7 {
bysort global: egen re_`v'=mean(`v')
}

label define yesno_gl  0 "No" 1 "Yes"
label values global yesno_gl

keep global re_*
duplicates drop re_HMpr1, force
reshape long re_HMpr, i(global) j(HM_7)
ren global lab
decode lab, g(re_lab)
g byvar="General political ideology"

save "prpHM_global_`X'`n'.dta", replace
restore

* issue
preserve
keep HMpr1-HMpr7 issue
foreach v of varlist HMpr1-HMpr7 {
bysort issue: egen re_`v'=mean(`v')
}

keep issue re_*
duplicates drop re_HMpr1, force
reshape long re_HMpr, i(issue) j(HM_7)

ren issue lab
decode lab, g(re_lab)
g byvar="Issue"

save "prpHM_issue_`X'`n'.dta", replace
restore

* Influence
preserve
keep HMpr1-HMpr7 influence
foreach v of varlist HMpr1-HMpr7 {
bysort influence: egen re_`v'=mean(`v')
}

keep influence re_*
duplicates drop re_HMpr1, force
reshape long re_HMpr, i(influence) j(HM_7)

ren influence lab
decode lab, g(re_lab)
g byvar="N of groups included in a model"


save "prpHM_influence_`X'`n'.dta", replace
restore

* region
preserve
g byte temp =us
drop us
ren temp us
label values us lb_us

keep HMpr1-HMpr7 us
foreach v of varlist HMpr1-HMpr7 {
bysort us: egen re_`v'=mean(`v')
}

keep us re_*
duplicates drop re_HMpr1, force
reshape long re_HMpr, i(us) j(HM_7)

ren us lab
decode lab, g(re_lab)
g byvar="Region"


save "prpHM_region_`X'`n'.dta", replace
restore

* party
use "coef_wide.dta", clear
label define lb_us  0 "Not U.S." 1 "U.S."
label values us lb_us

meologit HM_7_`X'`n' global i.issue i.party influence distance_HM ln_n pre_diff_HM if us==1 & p_HM_10==1 || study:
predict HMpr* if e(sample)
keep if e(sample)

keep HMpr1-HMpr7 party
foreach v of varlist HMpr1-HMpr7 {
bysort party: egen re_`v'=mean(`v')
}

keep party re_*
duplicates drop re_HMpr1, force
reshape long re_HMpr, i(party) j(HM_7)

ren party lab
decode lab, g(re_lab)
g byvar="Partisanship"

save "prpHM_party_`X'`n'.dta", replace


*** combining all estimates in one dataset

use "prpHM_issue_`X'`n'.dta", clear
append using "prpHM_global_`X'`n'.dta"
append using "prpHM_influence_`X'`n'.dta"
append using "prpHM_region_`X'`n'.dta"
append using "prpHM_party_`X'`n'.dta"

g id=1 if byvar=="Region"
replace id=2 if byvar=="N of groups included in a model"
replace id=3 if byvar=="Partisanship"
replace id=4 if byvar=="General political ideology"
replace id=5 if byvar=="Issue"

label values lab .

save "prpHM_all_`X'`n'.dta", replace
}

*****************

* Five cat
cd ""
use "coef_wide.dta", clear

* Table B5
* HL
meologit HL_5 global i.issue influence  us distance_HL ln_n pre_diff_HL if p_HL_10==1 || study:
outreg2 using reg_table, tex  dec(2) alpha(0.05) symbol(*) addstat(Log Likelihood, `e(ll)') sortvar(us influence  party global issue distance_HL distance_HM ln_n) lab replace
*US
meologit HL_5 global i.issue i.party influence  distance_HL ln_n pre_diff_HL if us==1 & p_HL_10==1 || study:
outreg2 using reg_table, tex  dec(2) alpha(0.05) symbol(*) addstat(Log Likelihood, `e(ll)') sortvar(us influence  party global issue distance_HL distance_HM ln_n) lab append
* HM
meologit HM_5 global i.issue influence  us distance_HM ln_n pre_diff_HM if p_HM_10==1 || study:
outreg2 using reg_table, tex  dec(2) alpha(0.05) symbol(*) addstat(Log Likelihood, `e(ll)') sortvar(us influence  party global issue distance_HL distance_HM ln_n) lab append
*US
meologit HM_5 global i.issue i.party influence  distance_HM ln_n pre_diff_HM if us==1 & p_HM_10==1 || study:
outreg2 using reg_table, tex  dec(2) alpha(0.05) symbol(*) addstat(Log Likelihood, `e(ll)') sortvar(us influence  party global issue distance_HL distance_HM ln_n) lab append


* Figures B13-B14
**** calculated predicted probabilities to graph - this code is for the high vs low comparison
use "coef_wide.dta", clear
meologit HL_5 global i.issue influence us distance_HL ln_n pre_diff_HL if p_HL_10==1 || study:
predict pr* if e(sample)
keep if e(sample)


* Global
preserve
keep pr1-pr5 global
foreach v of varlist pr1-pr5 {
bysort global: egen re_`v'=mean(`v')
}

label define yesno_gl  0 "No" 1 "Yes"
label values global yesno_gl


keep global re_*
duplicates drop re_pr1, force
reshape long re_pr, i(global) j(HL_5)

ren global lab
decode lab, g(re_lab)
g byvar="General political ideology"


save "prpHL_global_DV5.dta", replace
restore

* issue
preserve
keep pr1-pr5 issue
foreach v of varlist pr1-pr5 {
bysort issue: egen re_`v'=mean(`v')
}

keep issue re_*
duplicates drop re_pr1, force
reshape long re_pr, i(issue) j(HL_5)

ren issue lab
decode lab, g(re_lab)
g byvar="Issue"

save "prpHL_issue_DV5.dta", replace
restore


* Influence
preserve
keep pr1-pr5 influence
foreach v of varlist pr1-pr5 {
bysort influence: egen re_`v'=mean(`v')
}

keep influence re_*
duplicates drop re_pr1, force
reshape long re_pr, i(influence) j(HL_5)

ren influence lab
decode lab, g(re_lab)
g byvar="N of groups included in a model"

save "prpHL_influence_DV5.dta", replace
restore

* Region
preserve
g byte temp =us
drop us
ren temp us
label define lb_us  0 "Not U.S." 1 "U.S."
label values us lb_us

keep pr1-pr5 us
foreach v of varlist pr1-pr5 {
bysort us: egen re_`v'=mean(`v')
}

keep us re_*
duplicates drop re_pr1, force
reshape long re_pr, i(us) j(HL_5)

ren us lab
decode lab, g(re_lab)
g byvar="Region"

save "prpHL_region_DV5.dta", replace
restore

* Partisanship
use "coef_wide.dta", clear
meologit HL_5 global i.issue i.party influence distance_HL ln_n pre_diff_HL if us==1 & p_HL_10==1 || study:
predict pr* if e(sample)
keep if e(sample)

keep pr1-pr5 party
foreach v of varlist pr1-pr5 {
bysort party: egen re_`v'=mean(`v')
}

keep party re_*
duplicates drop re_pr1, force
reshape long re_pr, i(party) j(HL_5)

ren party lab
decode lab, g(re_lab)
g byvar="Partisanship"

save "prpHL_party_DV5.dta", replace

use "prpHL_global_DV5.dta", clear
append using "prpHL_issue_DV5.dta"
append using "prpHL_influence_DV5.dta"
append using "prpHL_region_DV5.dta"
append using "prpHL_party_DV5.dta"

g id=1 if byvar=="Region"
replace id=2 if byvar=="N of groups included in a model"
replace id=3 if byvar=="Partisanship"
replace id=4 if byvar=="General political ideology"
replace id=5 if byvar=="Issue"

label values lab .

save "prpHL_all_DV5.dta", replace


**** calculated predicted probabilities to graph - this code is for the high vs middle comparison
use "coef_wide.dta", clear
label define lb_us  0 "Not U.S." 1 "U.S."
label values us lb_us

meologit HM_5 global i.issue influence us distance_HM ln_n pre_diff_HM if p_HM_10==1 || study:
predict HMpr* if e(sample)
keep if e(sample)


* global
preserve
keep HMpr1-HMpr5 global
foreach v of varlist HMpr1-HMpr5 {
bysort global: egen re_`v'=mean(`v')
}

label define yesno_gl  0 "No" 1 "Yes"
label values global yesno_gl

keep global re_*
duplicates drop re_HMpr1, force
reshape long re_HMpr, i(global) j(HM_5)
ren global lab
decode lab, g(re_lab)
g byvar="General political ideology"

save "prpHM_global_DV5.dta", replace
restore

* issue
preserve
keep HMpr1-HMpr5 issue
foreach v of varlist HMpr1-HMpr5 {
bysort issue: egen re_`v'=mean(`v')
}

keep issue re_*
duplicates drop re_HMpr1, force
reshape long re_HMpr, i(issue) j(HM_5)

ren issue lab
decode lab, g(re_lab)
g byvar="Issue"

save "prpHM_issue_DV5.dta", replace
restore

* Influence
preserve
keep HMpr1-HMpr5 influence
foreach v of varlist HMpr1-HMpr5 {
bysort influence: egen re_`v'=mean(`v')
}

keep influence re_*
duplicates drop re_HMpr1, force
reshape long re_HMpr, i(influence) j(HM_5)

ren influence lab
decode lab, g(re_lab)
g byvar="N of groups included in a model"


save "prpHM_influence_DV5.dta", replace
restore

* region
preserve
g byte temp =us
drop us
ren temp us
label values us lb_us

keep HMpr1-HMpr5 us
foreach v of varlist HMpr1-HMpr5 {
bysort us: egen re_`v'=mean(`v')
}

keep us re_*
duplicates drop re_HMpr1, force
reshape long re_HMpr, i(us) j(HM_5)

ren us lab
decode lab, g(re_lab)
g byvar="Region"


save "prpHM_region_DV5.dta", replace
restore

* party
use "coef_wide.dta", clear
label define lb_us  0 "Not U.S." 1 "U.S."
label values us lb_us

meologit HM_5 global i.issue i.party influence distance_HM ln_n pre_diff_HM if us==1 & p_HL_10==1 || study:
predict HMpr* if e(sample)
keep if e(sample)

keep HMpr1-HMpr5 party
foreach v of varlist HMpr1-HMpr5 {
bysort party: egen re_`v'=mean(`v')
}

keep party re_*
duplicates drop re_HMpr1, force
reshape long re_HMpr, i(party) j(HM_5)

ren party lab
decode lab, g(re_lab)
g byvar="Partisanship"

save "prpHM_party_DV5.dta", replace


*** combining all estimates in one dataset

use "prpHM_issue_DV5.dta", clear
append using "prpHM_global_DV5.dta"
append using "prpHM_influence_DV5.dta"
append using "prpHM_region_DV5.dta"
append using "prpHM_party_DV5.dta"

g id=1 if byvar=="Region"
replace id=2 if byvar=="N of groups included in a model"
replace id=3 if byvar=="Partisanship"
replace id=4 if byvar=="General political ideology"
replace id=5 if byvar=="Issue"

label values lab .

save "prpHM_all_DV5.dta", replace

*******************************
* Five cat - broader equal representation cat
use "coef_wide.dta", clear

* Table B6
* HL
meologit HL_5_alt1 global i.issue influence  us distance_HL ln_n pre_diff_HL if p_HL_10==1 || study:
outreg2 using reg_table, tex  dec(2) alpha(0.05) symbol(*) addstat(Log Likelihood, `e(ll)') sortvar(us influence  party global issue distance_HL distance_HM ln_n) lab replace
*US
meologit HL_5_alt1 global i.issue i.party influence  distance_HL ln_n pre_diff_HL if us==1 & p_HL_10==1 || study:
outreg2 using reg_table, tex  dec(2) alpha(0.05) symbol(*) addstat(Log Likelihood, `e(ll)') sortvar(us influence  party global issue distance_HL distance_HM ln_n) lab append
* HM
meologit HM_5_alt1 global i.issue influence  us distance_HM ln_n pre_diff_HM if p_HM_10==1 || study:
outreg2 using reg_table, tex  dec(2) alpha(0.05) symbol(*) addstat(Log Likelihood, `e(ll)') sortvar(us influence  party global issue distance_HL distance_HM ln_n) lab append
*US
meologit HM_5_alt1 global i.issue i.party influence  distance_HM ln_n pre_diff_HM if us==1 & p_HM_10==1 || study:
outreg2 using reg_table, tex  dec(2) alpha(0.05) symbol(*) addstat(Log Likelihood, `e(ll)') sortvar(us influence  party global issue distance_HL distance_HM ln_n) lab append


* Figures B16-B17
**** calculated predicted probabilities to graph - this code is for the high vs low comparison
use "coef_wide.dta", clear
meologit HL_5_alt1 global i.issue influence us distance_HL ln_n pre_diff_HL if p_HL_10==1 || study:
predict pr* if e(sample)
keep if e(sample)


* Global
preserve
keep pr1-pr5 global
foreach v of varlist pr1-pr5 {
bysort global: egen re_`v'=mean(`v')
}

label define yesno_gl  0 "No" 1 "Yes"
label values global yesno_gl


keep global re_*
duplicates drop re_pr1, force
reshape long re_pr, i(global) j(HL_5)

ren global lab
decode lab, g(re_lab)
g byvar="General political ideology"


save "prpHL_global_DV5_alt1.dta", replace
restore

* issue
preserve
keep pr1-pr5 issue
foreach v of varlist pr1-pr5 {
bysort issue: egen re_`v'=mean(`v')
}

keep issue re_*
duplicates drop re_pr1, force
reshape long re_pr, i(issue) j(HL_5)

ren issue lab
decode lab, g(re_lab)
g byvar="Issue"

save "prpHL_issue_DV5_alt1.dta", replace
restore


* Influence
preserve
keep pr1-pr5 influence
foreach v of varlist pr1-pr5 {
bysort influence: egen re_`v'=mean(`v')
}

keep influence re_*
duplicates drop re_pr1, force
reshape long re_pr, i(influence) j(HL_5)

ren influence lab
decode lab, g(re_lab)
g byvar="N of groups included in a model"

save "prpHL_influence_DV5_alt1.dta", replace
restore

* Region
preserve
g byte temp =us
drop us
ren temp us
label define lb_us  0 "Not U.S." 1 "U.S."
label values us lb_us

keep pr1-pr5 us
foreach v of varlist pr1-pr5 {
bysort us: egen re_`v'=mean(`v')
}

keep us re_*
duplicates drop re_pr1, force
reshape long re_pr, i(us) j(HL_5)

ren us lab
decode lab, g(re_lab)
g byvar="Region"

save "prpHL_region_DV5_alt1.dta", replace
restore

* Partisanship
use "coef_wide.dta", clear
meologit HL_5_alt1 global i.issue i.party influence distance_HL ln_n pre_diff_HL if us==1 & p_HL_10==1 || study:
predict pr* if e(sample)
keep if e(sample)

keep pr1-pr5 party
foreach v of varlist pr1-pr5 {
bysort party: egen re_`v'=mean(`v')
}

keep party re_*
duplicates drop re_pr1, force
reshape long re_pr, i(party) j(HL_5)

ren party lab
decode lab, g(re_lab)
g byvar="Partisanship"

save "prpHL_party_DV5_alt1.dta", replace

use "prpHL_global_DV5_alt1.dta", clear
append using "prpHL_issue_DV5_alt1.dta"
append using "prpHL_influence_DV5_alt1.dta"
append using "prpHL_region_DV5_alt1.dta"
append using "prpHL_party_DV5_alt1.dta"

g id=1 if byvar=="Region"
replace id=2 if byvar=="N of groups included in a model"
replace id=3 if byvar=="Partisanship"
replace id=4 if byvar=="General political ideology"
replace id=5 if byvar=="Issue"

label values lab .

save "prpHL_all_DV5_alt1.dta", replace


**** calculated predicted probabilities to graph - this code is for the high vs middle comparison
use "coef_wide.dta", clear
label define lb_us  0 "Not U.S." 1 "U.S."
label values us lb_us

meologit HM_5_alt1 global i.issue influence us distance_HM ln_n pre_diff_HM if p_HM_10==1 || study:
predict HMpr* if e(sample)
keep if e(sample)


* global
preserve
keep HMpr1-HMpr5 global
foreach v of varlist HMpr1-HMpr5 {
bysort global: egen re_`v'=mean(`v')
}

label define yesno_gl  0 "No" 1 "Yes"
label values global yesno_gl

keep global re_*
duplicates drop re_HMpr1, force
reshape long re_HMpr, i(global) j(HM_5)
ren global lab
decode lab, g(re_lab)
g byvar="General political ideology"

save "prpHM_global_DV5_alt1.dta", replace
restore

* issue
preserve
keep HMpr1-HMpr5 issue
foreach v of varlist HMpr1-HMpr5 {
bysort issue: egen re_`v'=mean(`v')
}

keep issue re_*
duplicates drop re_HMpr1, force
reshape long re_HMpr, i(issue) j(HM_5)

ren issue lab
decode lab, g(re_lab)
g byvar="Issue"

save "prpHM_issue_DV5_alt1.dta", replace
restore

* Influence
preserve
keep HMpr1-HMpr5 influence
foreach v of varlist HMpr1-HMpr5 {
bysort influence: egen re_`v'=mean(`v')
}

keep influence re_*
duplicates drop re_HMpr1, force
reshape long re_HMpr, i(influence) j(HM_5)

ren influence lab
decode lab, g(re_lab)
g byvar="N of groups included in a model"


save "prpHM_influence_DV5_alt1.dta", replace
restore

* region
preserve
g byte temp =us
drop us
ren temp us
label values us lb_us

keep HMpr1-HMpr5 us
foreach v of varlist HMpr1-HMpr5 {
bysort us: egen re_`v'=mean(`v')
}

keep us re_*
duplicates drop re_HMpr1, force
reshape long re_HMpr, i(us) j(HM_5)

ren us lab
decode lab, g(re_lab)
g byvar="Region"


save "prpHM_region_DV5_alt1.dta", replace
restore

* party
use "coef_wide.dta", clear
label define lb_us  0 "Not U.S." 1 "U.S."
label values us lb_us

meologit HM_5_alt1 global i.issue i.party influence distance_HM ln_n pre_diff_HM if us==1 & p_HL_10==1 || study:
predict HMpr* if e(sample)
keep if e(sample)

keep HMpr1-HMpr5 party
foreach v of varlist HMpr1-HMpr5 {
bysort party: egen re_`v'=mean(`v')
}

keep party re_*
duplicates drop re_HMpr1, force
reshape long re_HMpr, i(party) j(HM_5)

ren party lab
decode lab, g(re_lab)
g byvar="Partisanship"

save "prpHM_party_DV5_alt1.dta", replace


*** combining all estimates in one dataset

use "prpHM_issue_DV5_alt1.dta", clear
append using "prpHM_global_DV5_alt1.dta"
append using "prpHM_influence_DV5_alt1.dta"
append using "prpHM_region_DV5_alt1.dta"
append using "prpHM_party_DV5_alt1.dta"

g id=1 if byvar=="Region"
replace id=2 if byvar=="N of groups included in a model"
replace id=3 if byvar=="Partisanship"
replace id=4 if byvar=="General political ideology"
replace id=5 if byvar=="Issue"

label values lab .

save "prpHM_all_DV5_alt1.dta", replace

